diff --git a/action.php b/action.php
index 3756317..c13139f 100644
--- a/action.php
+++ b/action.php
@@ -431,7 +431,56 @@ protected function _show($reply = null, $edit = null) {
ptln('', 2);
ptln('
', 2);
}
-
+
+ // How many items to list per page
+ $nItemsPerPage = 50;
+ // How many pages will there be
+ $max_pages = ceil($cnt / $nItemsPerPage);
+ // What page are we currently on?
+ $page = min($max_pages, filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, array(
+ 'options' => array(
+ 'default' => 1,
+ 'min_range' => 1,
+ ),
+ )));
+ // now display the comments
+ if (isset($data['comments'])) {
+ if (!$this->getConf('usethreading')) {
+ $data['comments'] = $this->_flattenThreads($data['comments']);
+ uasort($data['comments'], '_sortCallback');
+ }
+ if($this->getConf('newestfirst')) {
+ $data['comments'] = array_reverse($data['comments']);
+ }
+ foreach (array_slice ($data['comments'], $nItemsPerPage*($page-1), $nItemsPerPage) as $key => $value) {
+ if ($key == $edit) $this->_form($value['raw'], 'save', $edit); // edit form
+ else $this->_print($key, $data, '', $reply);
+ }
+ }
+ // Previous Button
+ $previous = '';
+ if($_GET['page'] > 1)
+ $previous .= '
';
+ $previous .= 'Previous';
+ $previous .= '';
+ // Next Button
+ $next = '';
+ if($_GET['page'] < $max_pages)
+ if($_GET['page'] == 0)//the page=1 url doesn't show up at first so need to count from 2 at the beginning
+ $next .= '
';
+ else
+ $next .= '';
+ $next .= ' Next';
+ $next .= '';
+ // Comment Amount
+ $comment_amount = '';
+ $comment_amount .= '
' .$cnt.' Comments';
+ // Page Amount
+ $page_amount = '';
+ $page_amount .= '
' .$max_pages.' Pages';
+ // Call the data
+ echo ''.NL;
+
// now display the comments
if (isset($data['comments'])) {
if (!$this->getConf('usethreading')) {