diff --git a/index.php b/index.php index c89213e..dc84a98 100644 --- a/index.php +++ b/index.php @@ -222,6 +222,27 @@ if ($res = $DB->query(kl_str_sql("select * from builds where chan=!s $where orde $nrBuilds = count($builds); +if ($res = $DB->query(kl_str_sql("select count(*) from builds where chan=!s", $chan))) { + if ($row = $DB->fetchRow($res)) { + $total = (int)$row[0]; + } +} + + +$nextLink = "#"; +$prevLink = "#"; + +if ($page > 0) $prevLink = "?page=" . ($page - 1); +if ($page < (int)($total / $pageSize)) $nextLink = "?page=" . ($page + 1); + +$paginator .= '<Previous'; + +$paginator .= "  Page " . ($page + 1) . " of " . ceil($total / $pageSize) . "   "; + +$paginator .= 'Next>'; + +print $paginator; + if ($nrBuilds) { print ''; @@ -235,14 +256,7 @@ if ($nrBuilds) { } -print "
\n"; - -if ($page > 0) { - print '<< Previous  '; - } - -print 'Next >>'; - +print "
\n" . $paginator; Layout::footer();