added pagination to gallery