<nav>
  <ul class="pagination justify-content-center">
    <li class="page-item">
      <a class="page-link <?php if ($page === 0) echo "disabled" ?>" href="?p=<?= $page > 0 ? $page - 1 : 0 ?>">
        <span aria-hidden="true">&laquo;</span>
      </a>
    </li>
    <?php for ($i = 0; $i <= $maxPage; $i++) { ?>
      <li class="page-item <?php if ($page === $i) echo "active" ?>">
        <a class="page-link" href="?p=<?= $i ?>"><?= $i + 1 ?></a>
      </li>
    <?php } ?>
    <li class="page-item">
      <a class="page-link <?php if ($page === $maxPage) echo "disabled" ?>" href="?p=<?= $page < $maxPage ? $page + 1 : $maxPage ?>">
        <span aria-hidden="true">&raquo;</span>
      </a>
    </li>
  </ul>
</nav>