0
I am trying to use bootstrap4 pagination but the active page is coming wrong. For example, the first page comes as page 2. My code looks like this:
<nav>
<ul class="pagination">
<li>
<a href="?id=45&pg=<?php echo $num_paginas-1; ?>" aria-label="Anterior">
<span aria-hidden="true">«</span>
</a>
</li>
<?php
for($i=0;$i<$num_paginas;$i++){
$estilo = "";
if($pagina == $i)
$estilo = "class=\"active\"";
?>
<li <?php echo $estilo; ?> ><a href="?id=45&pg=<?php echo $i; ?>"><?php echo $i+1; ?></a></li>
<?php } ?>
<li>
<a href="?id=45&pg=<?php echo $num_paginas+1; ?>" aria-label="Próximo">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>