Pagination X of Y

I have a set of subpages. I am attempting to use $pagination to display the current page number of the total page number, of a list of visible subpages. I want to show the current page number of the active subpage (the subpage the use is currently on).

<?php

$list       = $page->siblings()->paginate(1);
$pagination = $list->pagination();

?>
<nav>
    <span><?php echo $pagination->page() ?></span>
    <span>of</span>
    <span><?php echo $pagination->pages() ?></span>
</nav>

This bit is correctly showing the total number of siblings, but each page displays the starting index (1), rather than the current index. Am I approaching this the wrong way?

Does it output the correct page? Otherwise the problem could be that the pagination doesn’t get the current page ID from the URL param in the first place.

It correctly grabs the total number of visible pages, but current page is always 1. Sort of at a loss as to why? Perhaps I’ve missed a step somewhere?

How do you move from one page to the next? When the url changes to /page:2, the index should change as well.

I have previous and next arrows that function. The url doesn’t update to page:X, it just shows the current page title.

Could you post your code for your previous/next function? Does not sound as if you were using the pagination object for achieving that?

    <?php if($page->hasPrevVisible()): ?>
    <a href="<?php echo $page->prevVisible()->url() ?>">previous page</a>
    <?php endif ?>

    <?php if($page->hasNextVisible()): ?>
    <a href="<?php echo $page->nextVisible()->url() ?>">next page</a>
    <?php endif ?>

This part is working, arrows go between subpages in order I have set in the panel

Yes, that what I thought. But you need to use the pagination object to switch between the items of the collection, as described in the docs:

<?php if($pagination->hasPrevPage()): ?>
<a href="<?php echo $pagination->prevPageUrl() ?>">
  prev (<?php echo $pagination->prevPage() ?>)
</a>
<?php endif ?>

<?php if($pagination->hasNextPage()): ?>
<a href="<?php echo $pagination->nextPageUrl() ?>">
  next (<?php echo $pagination->nextPage() ?>)
</a>
<?php endif ?>

http://getkirby.com/docs/cheatsheet/pagination/has-next-page