added pagination for gallery