Adding ajax pagination

What do you mean by 0? Which value can take 0 here? $currentPage can never be 0. In case where $currentPage is 1 => previous page button won't be shown at all so this won't be a problem.