Added page numbering control feature when in gallery mode

Seems to have problem with indentation. What editor did you use to format your code like this ?