MOON
Server: Apache
System: Linux ip-208-109-13-31.ip.secureserver.net 3.10.0-1160.119.1.el7.tuxcare.els4.x86_64 #1 SMP Sat Aug 31 06:58:57 UTC 2024 x86_64
User: durgeshpandey215 (1013)
PHP: 8.1.29
Disabled: NONE
Upload Files
File: /home/durgeshpandey215/www/zeeroprice.skilladders.com/paginate.php
<style>
div.pagination {
	padding: 3px;
	margin: 25px 0px 25px 0px;
	display:block;
}

div.pagination a {
  border: 1px solid #AAAADD;
    color: #000000;
    margin: 2px;
    padding: 1vw 1vw;
    text-decoration: none;
}
div.pagination a:hover, div.pagination a:active {
	border: 1px solid #000000;
	background-color: #e91e63;
	color: #fff;
}
div.pagination span.current {
    background-color: #e91e63;
    border: 1px solid #000000;
    color: #FFFFFF;
    font-weight: bold;
    margin: 2px;
    padding: 1vw 1vw;
}
div.pagination span.disabled {
	padding: 1vw 1vw;
	margin: 2px;
	border: 1px solid #EEE;
	color: #DDD;
}
	
</style>
<?
	// paginatetable needed
	$page = (isset($_REQUEST['page']))? $_REQUEST['page'] : 1 ;
	
	$rows = $db->arraybuilder()->paginate($paginatetable, $page);
	//echo "showing $page out of " . $db->totalPages;
	//print_r($rows);
	
	$total_rows = $db->totalCount;
	
	$extra = (isset($extra))? $extra : "";
	
	/* Setup page vars for display. */
	if ($page == 0) $page = 1;					//if no page var is given, default to 1.
	$prev = $page - 1;							//previous page is page - 1
	$next = $page + 1;							//next page is page + 1
	$lastpage = ceil($total_rows/$limit);		//lastpage is = total pages / items per page, rounded up.
	
	$pagination = "";
	if($lastpage > 1)
	{	
		$pagination .= "<div class=\"pagination\">";
		//previous button
		if ($page > 1){
			//$pagination.= "<a href=\"$targetpage?page=1&$extra\">First</a>";
			$pagination.= "<a href=\"$targetpage?page=$prev&$extra\">Previous</a>";
		}else{
			//$pagination.= "<span class=\"disabled\">First</span>";
			$pagination.= "<span class=\"disabled\">Previous</span>";
		}
		//pages
		if ($lastpage < ($adjacents))	//not enough pages to bother breaking it up
		{	
			for ($counter = 1; $counter <= $lastpage; $counter++)
			{
				if ($counter == $page)
					$pagination.= "<span class=\"current\">$counter</span>";
				else
					$pagination.= "<a href=\"$targetpage?page=$counter&$extra\">$counter</a>";					
			}
		}
		elseif($lastpage > $adjacents)	//enough pages to hide some
		{
				
$start = ($page <= $adjacents ? 1 : $page - $adjacents);
$end = ($page > $lastpage - $adjacents ? $lastpage : $page + $adjacents);

for($i= $start; $i <= $end; $i++){
	if($i==$page){
		$pagination.= "<span class=\"current\">$i</span>";
	}else{
		$pagination.= "<a href=\"$targetpage?page=$i&$extra\">$i</a>";
	}
}
		}
			
		//next button
		if ($page < $lastpage){
			$pagination.= "<a href=\"$targetpage?page=$next&$extra\">Next</a>";
			//$pagination.= "<a href=\"$targetpage?page=$lastpage&$extra\">Last</a>";
		}else{
			$pagination.= "<span class=\"disabled\">Next</span>";
			//$pagination.= "<span class=\"disabled\">Last</span>";
			$pagination.= "</div>\n";
		}
	}
?>