diff --git a/system/pages/highscores.php b/system/pages/highscores.php
index 39eacb04..f890143c 100644
--- a/system/pages/highscores.php
+++ b/system/pages/highscores.php
@@ -15,10 +15,14 @@ $configHighscoresCountryBox = config('highscores_country_box');
if(config('account_country') && $configHighscoresCountryBox)
require SYSTEM . 'countries.conf.php';
-$list = isset($_GET['list']) ? $_GET['list'] : '';
-$_page = isset($_GET['page']) ? $_GET['page'] : 0;
+$list = isset($_GET['list']) ? $_GET['list'] : 'experience';
+$_page = isset($_GET['page']) ? $_GET['page'] : 1;
$vocation = isset($_GET['vocation']) ? $_GET['vocation'] : 'all';
+if(!is_numeric($_page) || $_page < 1 || $_page > PHP_INT_MAX) {
+ $_page = 1;
+}
+
$add_sql = '';
$configHighscoresVocationBox = config('highscores_vocation_box');
@@ -146,7 +150,7 @@ if ($cache->enabled()) {
}
}
-$offset = $_page * $configHighscoresPerPage;
+$offset = ($_page - 1) * $configHighscoresPerPage;
if (!isset($highscores) || empty($highscores)) {
if ($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
@@ -274,14 +278,9 @@ foreach($highscores as $id => &$player)
}
}
-if(!$i) {
- $extra = ($configHighscoresOutfit ? 1 : 0);
- echo '
No records yet. |
';
-}
-
//link to previous page if actual page is not first
$linkPreviousPage = '';
-if($_page > 0) {
+if($_page > 1) {
$linkPreviousPage = getLink('highscores') . '/' . $list . ($vocation !== 'all' ? '/' . $vocation : '') . '/' . ($_page - 1);
}
@@ -291,7 +290,6 @@ if($show_link_to_next_page) {
$linkNextPage = getLink('highscores') . '/' . $list . ($vocation !== 'all' ? '/' . $vocation : '') . '/' . ($_page + 1);
}
-
$types = array(
'experience' => 'Experience',
'magic' => 'Magic',
@@ -313,6 +311,7 @@ if(config('highscores_balance'))
/** @var Twig\Environment $twig */
$twig->display('highscores.html.twig', [
'highscores' => $highscores,
+ 'totalRows' => $i - 1,
'list' => $list,
'skill' => $skill,
'skillName' => ($skill == SKILL_FRAGS ? 'Frags' : ($skill == SKILL_BALANCE ? 'Balance' : getSkillName($skill))),
diff --git a/system/templates/highscores.html.twig b/system/templates/highscores.html.twig
index 3aa4a983..e7741fdf 100644
--- a/system/templates/highscores.html.twig
+++ b/system/templates/highscores.html.twig
@@ -25,39 +25,43 @@
{% endif %}
- {% set row = 0 %}
- {% for player in highscores %}
-
- {% set row = row + 1 %}
+ {% if totalRows < 1 %}
+
No records yet. |
+ {% else %}
+ {% set row = 0 %}
+ {% for player in highscores %}
+
+ {% set row = row + 1 %}
- {% if config.account_country %}
- {{ player.flag|raw }} |
- {% endif %}
-
- {{ player.rank }}. |
-
- {% if config.highscores_outfit %}
- {{ player.outfit|raw }} |
- {% endif %}
-
-
-
- {{ player.name }}
-
- {% if config.highscores_vocation %}
- {{ player.vocation }}
+ {% if config.account_country %}
+ | {{ player.flag|raw }} |
{% endif %}
-
-
- {{ player.value }}
- |
+ {{ player.rank }}. |
- {% if skill == constant('POT::SKILL__LEVEL') %}
- {{ player.experience }} |
- {% endif %}
-
- {% endfor %}
+ {% if config.highscores_outfit %}
+ {{ player.outfit|raw }} |
+ {% endif %}
+
+
+
+ {{ player.name }}
+
+ {% if config.highscores_vocation %}
+ {{ player.vocation }}
+ {% endif %}
+ |
+
+
+ {{ player.value }}
+ |
+
+ {% if skill == constant('POT::SKILL__LEVEL') %}
+ {{ player.experience }} |
+ {% endif %}
+
+ {% endfor %}
+ {% endif %}
{% if linkPreviousPage|length > 0 %}
@@ -102,4 +106,4 @@
|
-
\ No newline at end of file
+