original_string: public function get_pagination($page = 0) {
          global $CFG, $OUTPUT;
          $count = $this->count();
          $perpage = (!empty($CFG->commentsperpage))?$CFG->commentsperpage:15;
          $pages = (int)ceil($count/$perpage);
          if ($pages == 1 || $pages == 0) {
              return html_writer::tag('div', '', array('id' => 'comment-pagination-'.$this->cid, 'class' => 'comment-pagination'));
          }
          if (!empty(self::$nonjs)) {
              // used in non-js interface
              return $OUTPUT->paging_bar($count, $page, $perpage, $this->get_nojslink(), 'comment_page');
          } else {
              // return ajax paging bar
              $str = '';
              $str .= '<div class="comment-paging" id="comment-pagination-'.$this->cid.'">';
              for ($p=0; $p<$pages; $p++) {
                  if ($p == $page) {
                      $class = 'curpage';
                  } else {
                      $class = 'pageno';
                  }
                  $str .= '<a href="#" class="'.$class.'" id="comment-page-'.$this->cid.'-'.$p.'">'.($p+1).'</a> ';
              }
              $str .= '</div>';
          }
          return $str;
      }
code: public function get_pagination($page = 0) {
          global $CFG, $OUTPUT;
          $count = $this->count();
          $perpage = (!empty($CFG->commentsperpage))?$CFG->commentsperpage:15;
          $pages = (int)ceil($count/$perpage);
          if ($pages == 1 || $pages == 0) {
              return html_writer::tag('div', '', array('id' => 'comment-pagination-'.$this->cid, 'class' => 'comment-pagination'));
          }
          if (!empty(self::$nonjs)) {
              // used in non-js interface
              return $OUTPUT->paging_bar($count, $page, $perpage, $this->get_nojslink(), 'comment_page');
          } else {
              // return ajax paging bar
              $str = '';
              $str .= '<div class="comment-paging" id="comment-pagination-'.$this->cid.'">';
              for ($p=0; $p<$pages; $p++) {
                  if ($p == $page) {
                      $class = 'curpage';
                  } else {
                      $class = 'pageno';
                  }
                  $str .= '<a href="#" class="'.$class.'" id="comment-page-'.$this->cid.'-'.$p.'">'.($p+1).'</a> ';
              }
              $str .= '</div>';
          }
          return $str;
      }
code_tokens: public function get_pagination ( $ page = 0 ) { global $ CFG , $ OUTPUT ; $ count = $ this -> count ( ) ; $ perpage = ( ! empty ( $ CFG -> commentsperpage ) ) ? $ CFG -> commentsperpage : 15 ; $ pages = ( int ) ceil ( $ count / $ perpage ) ; if ( $ pages == 1 || $ pages == 0 ) { return html_writer :: tag ( 'div' , '' , array ( 'id' => 'comment-pagination-' . $ this -> cid , 'class' => 'comment-pagination' ) ) ; } if ( ! empty ( self :: $ nonjs ) ) { // used in non-js interface return $ OUTPUT -> paging_bar ( $ count , $ page , $ perpage , $ this -> get_nojslink ( ) , 'comment_page' ) ; } else { // return ajax paging bar $ str = '' ; $ str .= '<div class="comment-paging" id="comment-pagination-' . $ this -> cid . '">' ; for ( $ p = 0 ; $ p < $ pages ; $ p ++ ) { if ( $ p == $ page ) { $ class = 'curpage' ; } else { $ class = 'pageno' ; } $ str .= '<a href="#" class="' . $ class . '" id="comment-page-' . $ this -> cid . '-' . $ p . '">' . ( $ p + 1 ) . '</a> ' ; } $ str .= '</div>' ; } return $ str ; }
docstring: Returns HTML to display a pagination bar
  
  @global stdClass $CFG
  @global core_renderer $OUTPUT
  @param int $page
  @return string
docstring_tokens: Returns HTML to display a pagination bar