403Webshell
Server IP : 172.67.187.206  /  Your IP : 172.71.28.155
Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586
User : SYSTEM ( 0)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  E:/Inetpub/www/news/elearning/libs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : E:/Inetpub/www/news/elearning/libs/pagination.php
<?php

/**
 * @author Shahrukh
 */
class Pagination {

  private $_page_num;
  private $_records_per_page;
  private $_lower_limit;
  private $_total_records;
  private $_total_pages;

  public function __construct($total_records, $pagenum = 1, $rpp = 10 ) {
    if (!(isset($pagenum))) {
      $this->_page_num = 1;
    } else {
      $this->_page_num = $pagenum;
    }

    $this->_records_per_page = ($rpp <> "" && is_numeric($rpp) ) ? $rpp : 10;
    
    $this->_total_records = intval($total_records);

    //Calculate the last page based on total number of rows and rows per page.
    $this->_total_pages = ceil($this->_total_records / $this->_records_per_page);


    $this->set_page_num();
  }

  private function set_page_num() {
    if ($this->_page_num < 1) {
      $this->_page_num = 1;
    } elseif ($this->_page_num > $this->_total_pages) {
      $this->_page_num = $this->_total_pages;
    }
    $this->_page_num = intval($this->_page_num);


    $this->_lower_limit = ($this->_page_num - 1) * $this->_records_per_page;
  }

  public function display_links($pagename) {

    if ($this->_total_pages > 0) {

      if ($this->_page_num > 1) {
        echo '<li><a href="' . generate_site_link($pagename, get_all_get_params(array("pagenum")) . "pagenum=1") . '">First</a></li>';
        echo '<li><a href="' . generate_site_link($pagename, get_all_get_params(array("pagenum")) . "pagenum=" . ($this->_page_num - 1)) . '">«</a></li>';
      }

      for ($i = 1; $i <= $this->_total_pages; $i++) {
        if ($i == $this->_page_num) {
          echo '<li class="active" ><a href="javascript:void(0);">' . $i . '</a></li>';
        } else {
          echo '<li><a href="' . generate_site_link($pagename, get_all_get_params(array("pagenum")) . "pagenum=" . $i) . '">' . $i . '</a></li>';
        }
      }

      if (($this->_page_num + 1) <= $this->_total_pages) {
        echo '<li><a href="' . generate_site_link($pagename, get_all_get_params(array("pagenum")) . "pagenum=" . ($this->_page_num + 1)) . '">»</a></li>';
      }

      if ($this->_page_num != $this->_total_pages) {
        echo '<li><a href="' . generate_site_link($pagename, get_all_get_params(array("pagenum")) . "pagenum=" . ($this->_total_pages)) . '">Last</a></li>';
      }
    }
  }

  public function total_pages() {
    return $this->_total_pages;
  }
  
  public function get_lower_limit() {
    return $this->_lower_limit;
  }
  
}

Youez - 2016 - github.com/yon3zu
LinuXploit