Will explain the solution to this problem with using a code written in PHP (you should be able to adapt this for other programming languages quite easily).
// first of all, we need the total number of all items to display (in the example this would be 23), usually a database count statement will give this number
$resultsOverall = 0;
// enter the maximum number of items per page here
$resultsPerPage = 10;
// the number of the current page (e.g. page 2 display items 9-16 in the example)
$pageNumber = 1;
// the current number is usually determined dynamically, that means we have to check which page we need to display
if(isset($_REQUEST["pageNumber"]) && $_REQUEST["pageNumber"] > 1) {
$pageNumber = $_REQUEST["pageNumber"];
}
/**** The logic ****/
// determine the first result to show (on example page 2 this will be 9)
$resultsFrom = ($pageNumber*$resultsPerPage-$resultsPerPage+1);
// determine the last result to show (on example page 2 this will be 16)
$resultsTo = ($resultsFrom-1)+$resultsPerPage;
// if the number of results to is bigger than the number of results overall, cut it (e.g. on example page three $resultsTo would be 24, but $resultsOverall would be 23, therefore it is cut)
if($resultsTo > $resultsOverall) {
$resultsTo = $resultsOverall;
}
// as a last step we have to determine the number of pages
$allPages = ceil($resultsOverall / $resultsPerPage);
// now we could proceed with some query ("SELECT * FROM items LIMIT $resultsFrom, $resultsTo") and display anything we need