initial pagination logic
Added logic for previous next buttons
fixed the pagination parameters