Add the ability to restrict the number of log entries returned

This is critical for interacting with repositories with thousands of commits that need to be paginated between. I have tried not to break the existing API, so all commits will still be returned by default and $file is still the first parameter