Improve handling of `.paginate(page: nil)`.

It is quite common for a controller to call `.paginate(page: params[:page])`,
and `params[:page]` would be nil when loading the first page. Subsequently,
`pagenum.to_i` would then evaluate to 0, and the dynamic limit won't be
adjusted correctly if there are less than one page worth of entries.