use ceil() for pagination rounding instead of intval()

This commit is contained in:
Your Name 2025-10-14 16:09:06 -04:00
parent 44158a0b00
commit aa6bbf4bd7

View file

@ -37,10 +37,15 @@ function nextButton($params) {
echo("<th><a href='" . $params . "'><button>Next</button></a></th>"); echo("<th><a href='" . $params . "'><button>Next</button></a></th>");
} }
function totalPages($limit) {
global $cat;
return ceil(getRowCount($cat)/$limit);
}
function pageLinks() { function pageLinks() {
global $page; global $page;
global $cat; global $cat;
for ($i=0; $i < (intval(getRowCount($cat)/14)); $i++) { for ($i=0; $i < totalPages(15); $i++) {
if ($page == $i+1) { if ($page == $i+1) {
echo("<td class='selectedpage'>"); echo("<td class='selectedpage'>");
} else { } else {
@ -57,7 +62,7 @@ function pageButtons() {
backButton(params($page-1)); backButton(params($page-1));
} }
pageLinks(); pageLinks();
if ($page < intval(getRowCount($cat)/14)) { if ($page < totalPages(15)) {
nextButton(params($page+1)); nextButton(params($page+1));
} }
} }