I've literally done about 5 different ways of creating a "pager" system for galleries. The easiest way I've found, and the most effeicent, is simply determining how many thumbnails you want to display per page, and create a page system.
First thing first, you decide what page they're already on, using the $_GET['page'] or something of the like, I don't use dynamic URI's for SEO reasons, but that's basically how it's done.
If the user isn't on a page, start them at page 1, gather the first batch of images, and the 'next' link will have page 2 in it, and previous will link them to the highest page possible. this goes as:
$total = ceil($totalRows / $perPage);
// example on paper:
/*
8 = @ 23 / 3
( 23 / 3 = 7 1/6, rounded up, equals 8)
*/
So that means we have 8 pages. Go to page 8, and we get the last remaining images in the DB. Go to the 2nd page, and it gets the next 3 images. Really it's just changing the offSet in your MySQL Query.
Example:
$result = mysql_query("SELECT * FROM myimages ORDER BY id ASC LIMIT $offSet,$totalPerPage);
$offSet is how many rows to skip
and $totalPerPage is how many to actually get.
hope this helps.