One way would be to loop through the directory list and put the values into an array. Then echo the contents of the array, limitted to the number of items per page. Then, once you hit this number (5), show a next page bnutton. This should pass the last index number of the array and your loop, instead of starting at 0, would then start at this number plus one.
amc