May use Math.max(0, currentPage - 1). Easier to read.