Fix bug: total pages less than visible