Show pagination if there are more pages than the range

Can someone point me in the right direction for dealing with this.

I have some pagination with a range of 2. I only have 2 albums so there is no other pages to paginate but it still shows the number 1 even though it’s the only page.

What kind of if statement do I need to wrap this in so it will only show if the pages to paginate are greater than the range.

<?php foreach($pagination->range(2) as $r): ?>
    <li class="o-pagination__item">
        <a href="<?php echo $pagination->pageURL($r) ?>" class="o-pagination__link o-pagination__<?= $r ?> <?php if($pagination->page() == $r) { echo 'is-active'; } ?>">
            <?php echo $r ?>
<?php endforeach ?>

$pagination->pages() returns the number of pagination pages, so you can use that in your if statement

<?php if($pagination->pages() > 1): ?>

Many thanks.