fix maxPerPage division by zero