this might be bit complicated but shows 4 page number before and after current page but only if they exist
PHP Code:
$num_pages = ceil($smileys/$imagesperpage);
if ($_GET['page'] - 4 < 1) $pagemin = 1;
else $pagemin = $_GET['page'] - 4;
$maxPage = $num_pages;
if ($_GET['page'] + 4 > $maxPage) $pagemax = $maxPage;
else $pagemax = $_GET['page'] + 4;
if ($_GET['page'] > 1) $controls .= "<a href=\"".$action."extras".$mod."smileys&page=".($_GET['page']-1)."\">Prev</a>\n";
else $controls .= "Prev\n";
for($page = $pagemin; $page <= $pagemax; $page++)
{
if ($page == $_GET['page']) $controls .= " $page \n";
else $controls .= " <a href=\"".$action."extras".$mod."smileys&page=$page\">$page</a> \n";
}
if ($_GET['page'] < $num_pages) $controls .= "<a href=\"".$action."extras".$mod."smileys&page=".($_GET['page']+1)."\">Next</a>";
else $controls .= "Next";
if ($page > 1 || $smileys > ($page*$imagesperpage)) $controls .= "<br/>";
Comment