I have been trying to build a gallery here using this source code.

It works fine for the first page of pictures but when you go onto the second page nothing shows up.

I know nothing about php so I am unable to spot any problem. Do I need to make any alterations to the code or is the problem to do with something else?

Thank you in advance.