每页分页限制图像

So i want to make pagination, for now i don't know how to limit the images per page. I am using glob to get all the image files showing up, but i should limit them to be able use the pagination. I i had a databse then i would know how to limit them, but when they are in folder, dont know actualy. Any help with that ?

<?php
    $files = glob("img/*.*");
    for ($i=1; $i<count($files); $i++){
        $image = $files[$i];
        //print $image ."<br />";
        echo '<img src="'.$image .'" alt="Random image" />';
    }
    $per_page = 9;
    $pages = ceil(count($files)/$per_page);
    $page = $_GET['page'];

    if(!isset($_GET['page'])){
        header("location: index.php?page=1");
    }else{
        $page = $_GET['page'];
    }
    //$start = (($page)*$per_page);
    for($number=1;$number<=$pages;$number++)
    {
        echo '<a href="?page='.$number.'">'.$number.'</a>';

    }
    echo "<br>Current page: $page";
    ?>

UPDATE:

When i change code to this, 4 images not showing up.. why its like that?

$per_page = 12;
$page = $_GET['page'];
$start = (($page -1)*$per_page);

$files = array_slice(glob("img/*.*"), $start, $per_page);