Fix maxPage calculation

Wrong maxPage is calculated if `len(targets)` is divisible by `perPage`.
For example, len(targets)=32, perPage=16 then maxPage=3 in original code.