add pagination to gallery