Numbered pagination

I may be missing something obvious here, but I am struggling to get numbered pagination working. I have seen this code block for range pagination:

<nav>
  <ul>

    <?php if ($pagination->hasPrevPage()): ?>
    <li>
      <a href="<?= $pagination->prevPageURL() ?>">‹</a>
    </li>
    <?php else: ?>
    <li>
      <span>‹</span>
    </li>
    <?php endif ?>

    <?php foreach ($pagination->range(10) as $r): ?>
    <li>
      <a<?= $pagination->page() === $r ? ' aria-current="page"' : '' ?> href="<?= $pagination->pageURL($r) ?>">
        <?= $r ?>
      </a>
    </li>
    <?php endforeach ?>

    <?php if ($pagination->hasNextPage()): ?>
    <li>
      <a href="<?= $pagination->nextPageURL() ?>">›</a>
    </li>
    <?php else: ?>
    <li>
      <span>›</span>
    </li>
    <?php endif ?>

  </ul>
</nav>

Which works great, but I want to output all the pagination links as numbers, without the next and previous links and without range() applied. How do I go about this?

All you need to do is to set the range param to the total number of pagination pages ($pagination->pages());

And remove the prev/next links.

Perfect, thank you