//Pages
$perpage = 10; // Avoid magic numbers
$files = glob('docs/*.xml');
$file_count = count($files);
$pages = ceil($file_count/$perpage);
$page = $_GET["page"];
$files = array_reverse($files)
$files = array_slice($files, ($page-1)*$perpage, $perpage);
if ((int) $page <= 0) { $page = 1; }