| 
                    
                    
	  
	
		
			
				class dividepage{ 
				 private $total; 
				 private $url; 
				 private $displaypg; 
				 private $page; 
				 private $lastpg; 
				 private $prepg; 
				 private $nextpg; 
				 private $firstcount; 
				 private $startd; 
				 private $stopd; 
				 
				public function __construct($url, $total, $displaypg){ 
				 $this->url = $url; 
				 $this->total = $total; 
				  
				 $this->displaypg = $displaypg; 
				 $this->initdividepage(); 
				  
				} 
				 
				private function initdividepage(){ 
				  
				 $parse_url = parse_url($this->url); 
				 $url_query = $parse_url['query']; 
				 if($url_query){ 
				  ereg('(^|&)page=([0-9]*)', $url_query, $k); 
				  $this->page = $k[2]; 
				  $url_query = ereg_replace("(^|&)page=$this->page", '', $url_query); 
				  $this->url = str_replace($parse_url['query'], $url_query, $this->url); 
				  $this->page = $this->page ? $this->page : 1; 
				  if($url_query){ 
				   $this->url .= '&page'; 
				  }else{ 
				   $this->url .= 'page'; 
				  } 
				 }else{ 
				  $this->page = 1; 
				  $this->url .= '?page'; 
				 } 
				 $this->lastpg = ceil($this->total / $this->displaypg); 
				    $this->page = min($this->lastpg, $this->page); 
				    $this->prepg = $this->page - 1; 
				    $this->nextpg = $this->page + 1; 
				    $this->firstcount = ($this->page - 1) * $this->displaypg; 
				 $this->startd = $this->total ? ($this->firstcount + 1) : 0; 
				 $this->stopd = min($this->firstcount + $this->displaypg, $this->total); 
				  
				  
				} 
				public function getpageinfo(){ 
                 |