I needed to override the default pagination in a component view template. Normally the pagination is shown with the line
<?php echo $this->pagination->getListFooter(); ?>
But in this instance I wanted to show the total number of filtered items.
After trawling through the files: libraries/src/Pagination/Pagination.php and layouts/joomla/pagination/links.php the answer was simple
Create a folder layouts/pagination in your component administrator folder. Copy the links.php file into that folder.
Instead of the usual getListFooter() line shown above use:
<?php echo $this->pagination->getPaginationLinks('pagination.links'); ?>
The getPaginationLinks function has the signature public function getPaginationLinks($layoutId = 'joomla.pagination.links', $options = [])
so it will take an alternative layout to use.
Now you can modify the links.php file for your component to get exactly the output you require.