refactor pagination codes and rename posts
edit
edit pagination