Edge case: fix bug for calculating max pageno when db is empty