-1
I have this code that makes me pagination, but I intend to limit to 4 links to each side.
The intended:
Previous,11,12,13,14,15,16,17,18,19,Next
Current code:
$qry1= pg_query($dbconn,"select * from tabela");
$registros = 100;
if(isset($_GET["pag"])){ $pag= $_GET["pag"]; }else{ $pag= 1; }
if($registros > pg_num_rows($qry1)){ $pag= 1; }
$inicio = ($pag- 1) * $registros;
$qry2= pg_query($dbconn,"select * from tabela limit $registros offset $inicio");
$totalregistros = pg_num_rows($qry2);
$totalpag = ceil(pg_num_rows($qry1) / $registros);
for ($i=1; $i<=$totalpag; $i++){
echo '<ul class="paginacao"><li $active><a href="index.php?pag='.$i.'">'.$i.'</a> </li></ul>';
}
Related: https://answall.com/questions/76906/links-para-pagina%C3%A7%C3%A3o-com-limites-de-exibi%C3%A7%C3%A3o-dos-links
– Wallace Maxters