Merge pull request #209 from triath/dont-show-empty-pages-in-highscore

Don't display options for empty pages in highscores
This commit is contained in:
Stefan A. Brannfjell 2015-08-17 02:23:27 +02:00
commit 9a1f08a5d1

View File

@ -64,7 +64,7 @@ if ($scores) {
</select>
<select name="page">
<?php
$pages = (int)($highscore['rows'] / $highscore['rowsPerPage']);
$pages = ceil(min(($highscore['rows'] / $highscore['rowsPerPage']), (count($scores[$type]) / $highscore['rowsPerPage'])));
for ($i = 0; $i < $pages; $i++) {
$x = $i + 1;
if ($x == $page) echo "<option value='".$x."' selected>Page: ".$x."</option>";
@ -103,4 +103,4 @@ if ($scores) {
</table>
<?php
}
include 'layout/overall/footer.php'; ?>
include 'layout/overall/footer.php'; ?>