From 345fbfe99f4488d7ee6a6bb01905e7aea65c755b Mon Sep 17 00:00:00 2001 From: Loui Chang Date: Thu, 22 Jan 2009 19:46:48 -0500 Subject: Only print links for up to five previous and next search results pages. Signed-off-by: Loui Chang --- web/template/pkg_search_results.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'web/template/pkg_search_results.php') diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index c098b286..6b5b2835 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -142,9 +142,19 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { $currentpage = 1; } - for ($i = 1; $i <= $pages; $i++) { + if ($currentpage + 5 < $pages) { + $pages = $currentpage + 5; + } + + # Display links for more search results. + for ($i = ($currentpage - 5); $i <= ($pages); $i++) { + if ($i < 1) { + $i = 1; + } + + $pagestart = ($i - 1) * $_GET['PP']; + if ($i <> $currentpage) : - $pagestart = ($i - 1) * $_GET['PP']; ?>