original_string: protected function createPageLinks()
      {
          $pageLinks = array();
  
          if ($this->totalPages > 10) {
              $startRange = $this->page - floor($this->range/2);
              $endRange   = $this->page + floor($this->range/2);
  
              //Start range
              if ($startRange <= 0) {
                  $startRange = 1;
                  $endRange += abs($startRange) + 1;
              }
  
              // End range
              if ($endRange > $this->totalPages) {
                  $startRange -= $endRange - $this->totalPages;
                  $endRange = $this->totalPages;
              }
  
              // Range
              $range = range($startRange, $endRange);
  
              // Add first page
              $this->pageLinks[] = array(
                  'page' => 1,
                  'uri'  => $this->createUri(1)
              );
  
              foreach ($range as $page) {
                  // Skip for first and last page
                  if ($page == 1 or $page == $this->totalPages) {
                      continue;
                  }
  
                  $this->pageLinks[] = array(
                      'page' => $page,
                      'uri'  => $this->createUri($page)
                  );
              }
  
              // Add last page
              $this->pageLinks[] = array(
                  'page' => $this->totalPages,
                  'uri'  => $this->createUri($this->totalPages)
              );
          } else {
              for ($i = 1; $i <= $this->totalPages; $i++) {
                  $this->pageLinks[] = array(
                      'page' => $i,
                      'uri'  => $this->createUri($i)
                  );
              }
          }
      }
code: protected function createPageLinks()
      {
          $pageLinks = array();
  
          if ($this->totalPages > 10) {
              $startRange = $this->page - floor($this->range/2);
              $endRange   = $this->page + floor($this->range/2);
  
              //Start range
              if ($startRange <= 0) {
                  $startRange = 1;
                  $endRange += abs($startRange) + 1;
              }
  
              // End range
              if ($endRange > $this->totalPages) {
                  $startRange -= $endRange - $this->totalPages;
                  $endRange = $this->totalPages;
              }
  
              // Range
              $range = range($startRange, $endRange);
  
              // Add first page
              $this->pageLinks[] = array(
                  'page' => 1,
                  'uri'  => $this->createUri(1)
              );
  
              foreach ($range as $page) {
                  // Skip for first and last page
                  if ($page == 1 or $page == $this->totalPages) {
                      continue;
                  }
  
                  $this->pageLinks[] = array(
                      'page' => $page,
                      'uri'  => $this->createUri($page)
                  );
              }
  
              // Add last page
              $this->pageLinks[] = array(
                  'page' => $this->totalPages,
                  'uri'  => $this->createUri($this->totalPages)
              );
          } else {
              for ($i = 1; $i <= $this->totalPages; $i++) {
                  $this->pageLinks[] = array(
                      'page' => $i,
                      'uri'  => $this->createUri($i)
                  );
              }
          }
      }
code_tokens: protected function createPageLinks ( ) { $ pageLinks = array ( ) ; if ( $ this -> totalPages > 10 ) { $ startRange = $ this -> page - floor ( $ this -> range / 2 ) ; $ endRange = $ this -> page + floor ( $ this -> range / 2 ) ; //Start range if ( $ startRange <= 0 ) { $ startRange = 1 ; $ endRange += abs ( $ startRange ) + 1 ; } // End range if ( $ endRange > $ this -> totalPages ) { $ startRange -= $ endRange - $ this -> totalPages ; $ endRange = $ this -> totalPages ; } // Range $ range = range ( $ startRange , $ endRange ) ; // Add first page $ this -> pageLinks [ ] = array ( 'page' => 1 , 'uri' => $ this -> createUri ( 1 ) ) ; foreach ( $ range as $ page ) { // Skip for first and last page if ( $ page == 1 or $ page == $ this -> totalPages ) { continue ; } $ this -> pageLinks [ ] = array ( 'page' => $ page , 'uri' => $ this -> createUri ( $ page ) ) ; } // Add last page $ this -> pageLinks [ ] = array ( 'page' => $ this -> totalPages , 'uri' => $ this -> createUri ( $ this -> totalPages ) ) ; } else { for ( $ i = 1 ; $ i <= $ this -> totalPages ; $ i ++ ) { $ this -> pageLinks [ ] = array ( 'page' => $ i , 'uri' => $ this -> createUri ( $ i ) ) ; } } }
docstring: Creates the page links.
docstring_tokens: Creates the page links .