/**
 * @var CommentList
 */
global $CommentList;
global $current_User;
global $dispatcher;
// If rediret_to was not set, create new redirect
$redirect_to = param('redirect_to', 'url', regenerate_url('', 'filter=restore', '', '&'));
$redirect_to = rawurlencode($redirect_to);
$save_context = param('save_context', 'boolean', 'true');
$show_comments = param('show_comments', 'string', 'all');
$item_id = param('item_id', 'integer', 0);
$currentpage = param('currentpage', 'integer', 0);
$comments_number = param('comments_number', 'integer', 0);
if ($item_id != 0 && $comments_number > 0) {
    echo_pages($item_id, $currentpage, $comments_number);
}
while ($Comment =& $CommentList->get_next()) {
    // Loop through comments:
    if ($show_comments == 'draft' && $Comment->get('status') != 'draft') {
        // if show only draft comments, and current comment status isn't draft, then continue with the next comment
        continue;
    }
    echo '<div id="comment_' . $Comment->ID . '">';
    echo_comment($Comment->ID, $redirect_to, $save_context);
    echo '</div>';
}
//end of the loop, don't delete
if ($item_id != 0 && $comments_number > 0) {
    echo_pages($item_id, $currentpage, $comments_number);
}
 function latest_crablar($mysqli)
 {
     $result = $mysqli->query("SELECT year,month,pages,MAX(edition_no) FROM crablar_archives");
     if ($row = mysqli_fetch_assoc($result)) {
         $year = $row['year'];
         $month = $row['month'];
         $pages = $row['pages'];
     } else {
         echo "<p>ALERT ALERT Crablar archives malfunctioning, please notify an admin of this error</p>";
         $year = 2014;
         $month = 'jul';
         $pages = 3;
     }
     echo_pages($year, $month, $pages);
 }