The computation of the lastPage index had an occasional off-by-one error when the page size evenly divided the number of recipes. The existing calculation worked most of the time because we were using Math.floor(), which was usually one less than the correct number of pages.
This fixes the calculation by correctly computing the total number of pages with Math.ceil() instead, and then making sure lastPage is always 0-indexed.
Fixes #63.
The computation of the
lastPage
index had an occasional off-by-one error when the page size evenly divided the number of recipes. The existing calculation worked most of the time because we were usingMath.floor()
, which was usually one less than the correct number of pages.This fixes the calculation by correctly computing the total number of pages with
Math.ceil()
instead, and then making surelastPage
is always 0-indexed.