<?php $pager->setSurroundCount(2); ?>

<nav aria-label="Page navigation">
    <ul class="pagination pagination-sm justify-content-end mb-0">
        <?php if ($pager->hasPreviousPage()): ?>
        <li class="page-item">
            <a href="<?= $pager->getFirstPageURL() ?>" class="page-link" aria-label="First">
                <span aria-hidden="true">&laquo;&laquo;</span>
            </a>
        </li>
        <li class="page-item">
            <a href="<?= $pager->getPreviousPageURL() ?>" class="page-link" aria-label="Previous">
                <span aria-hidden="true">&laquo;</span>
            </a>
        </li>
        <?php endif; ?>

        <?php foreach ($pager->links() as $link): ?>
        <li class="page-item <?= $link['active'] ? 'active' : '' ?>">
            <a href="<?= $link['uri'] ?>" class="page-link"><?= $link['title'] ?></a>
        </li>
        <?php endforeach; ?>

        <?php if ($pager->hasNextPage()): ?>
        <li class="page-item">
            <a href="<?= $pager->getNextPageURL() ?>" class="page-link" aria-label="Next">
                <span aria-hidden="true">&raquo;</span>
            </a>
        </li>
        <li class="page-item">
            <a href="<?= $pager->getLastPageURL() ?>" class="page-link" aria-label="Last">
                <span aria-hidden="true">&raquo;&raquo;</span>
            </a>
        </li>
        <?php endif; ?>
    </ul>
</nav>
