If you take a look at flickr.rb, you'll find its photos method simply
collects the photo ids returned by the Flickr method flickr.photos.search.
That Flickr method actually provides you with the total number of
matched items, but this information is not used by flickr.rb. You
may want to modify the photos method a bit so that it returns
that number (and perhaps other pagination info too, along with the
photos). Then just as Dogulas Shearer has said, you can go back and
forth using the page parameter.