Fix #1205 Fix calculation of current page