public function getPaginatedCommits($file = null, $page = 0)
{
$page = 15 * $page;
$pager = "--skip={$page} --max-count=15";
$command = "log {$pager} --pretty=format:\"<item><hash>%H</hash>" . '<short_hash>%h</short_hash><tree>%T</tree><parents>%P</parents>' . '<author>%aN</author><author_email>%aE</author_email>' . '<date>%at</date><commiter>%cN</commiter>' . '<commiter_email>%cE</commiter_email>' . '<commiter_date>%ct</commiter_date>' . '<message><![CDATA[%s]]></message></item>"';
if ($file) {
$command .= " {$file}";
}
try {
$logs = $this->getPrettyFormat($command);
} catch (\RuntimeException $e) {
return [];
}
foreach ($logs as $log) {
$commit = new Commit();
$commit->importData($log);
$commits[] = $commit;
}
return $commits;
}