From e71b6946f3515588d52a729d235289a63fa1df33 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Sat, 13 Apr 2013 20:01:27 +0200 Subject: [PATCH] Fixed /help paging --- src/API/ConsoleAPI.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/API/ConsoleAPI.php b/src/API/ConsoleAPI.php index 79639a2f..2b22bcd3 100644 --- a/src/API/ConsoleAPI.php +++ b/src/API/ConsoleAPI.php @@ -128,16 +128,16 @@ class ConsoleAPI{ } } $max = ceil(count($this->help) / 5); - $page = isset($params[0]) ? min($max - 1, max(0, intval($params[0]) - 1)):0; - $output .= "- Showing help page ". ($page + 1) ." of $max (/help ) -\n"; - $current = 0; + $page = (int) (isset($params[0]) ? min($max, max(1, intval($params[0]))):1); + $output .= "- Showing help page $page of $max (/help ) -\n"; + $current = 1; foreach($this->help as $c => $h){ - $curpage = (int) ($current / 5); + $curpage = (int) ceil($current / 5); if($curpage === $page){ $output .= "/$c ".$h."\n"; }elseif($curpage > $page){ break; - } + } ++$current; } break;