diff options
author | Loui Chang <louipc.ist@gmail.com> | 2009-01-23 01:46:48 +0100 |
---|---|---|
committer | Loui Chang <louipc.ist@gmail.com> | 2009-01-23 01:46:48 +0100 |
commit | 345fbfe99f4488d7ee6a6bb01905e7aea65c755b (patch) | |
tree | facf60d4a83b23eda3801bf4532131ec536eed5d /web/template | |
parent | 60d63cc6b71fd470dca444169e05c9d0f5e5013c (diff) | |
download | aur-345fbfe99f4488d7ee6a6bb01905e7aea65c755b.tar.gz aur-345fbfe99f4488d7ee6a6bb01905e7aea65c755b.tar.xz |
Only print links for up to five previous and next search results pages.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Diffstat (limited to 'web/template')
-rw-r--r-- | web/template/pkg_search_results.php | 14 |
1 files changed, 12 insertions, 2 deletions
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']; ?> <a href='packages.php?<?php print mkurl('O=' . ($pagestart))?>'><?php print "$i " ?></a> <?php else : print "[$i] "; |