Fix bug with paginate queries.
Merge branch '4.0'
Tweak how query elapsed time is calculated.
Merge branch '4.0'