I have this code that makes me paging, but I intend to limit the 4 links to each side.
Wanted:
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>';
}