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

<nav aria-label="Navigasi halaman">
    <ul class="pagination mb-0">
        <?php if ($pager->hasPrevious()) : ?>
            <li class="page-item">
                <a class="page-link" href="<?= esc($pager->getFirst(), 'attr') ?>" aria-label="Halaman awal">Awal</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="<?= esc($pager->getPrevious(), 'attr') ?>" aria-label="Halaman sebelumnya">Sebelumnya</a>
            </li>
        <?php else : ?>
            <li class="page-item disabled"><span class="page-link">Awal</span></li>
            <li class="page-item disabled"><span class="page-link">Sebelumnya</span></li>
        <?php endif; ?>

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

        <?php if ($pager->hasNext()) : ?>
            <li class="page-item">
                <a class="page-link" href="<?= esc($pager->getNext(), 'attr') ?>" aria-label="Halaman berikutnya">Berikutnya</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="<?= esc($pager->getLast(), 'attr') ?>" aria-label="Halaman akhir">Akhir</a>
            </li>
        <?php else : ?>
            <li class="page-item disabled"><span class="page-link">Berikutnya</span></li>
            <li class="page-item disabled"><span class="page-link">Akhir</span></li>
        <?php endif; ?>
    </ul>
</nav>
