Fix calculation of total pages

Signed-off-by: Stefan Marr <git@stefan-marr.de>