pagination and button class simplifying