laravel/framework — pull request #4242 by jmshelby (2014-04-24 17:52:50+00:00)
Title: Stashing limit/offset clause before performing total pagination count

Some database engines return zero, when using the count aggregate on a query with limit and offset. Just followed the same pattern for stashing the 'orders' clause before performing a count on the query, and adding back to the query when done.