<?php
/** @var string $repoName @var string $ref @var int $skip
 *  @var array $dateGroups (from group_log_by_date()) @var bool $hasMore */
?>
<div class="box">
<table>
<?php foreach ($dateGroups as $group): ?>
  <tr><td colspan="3" class="log-date"><?= $group['date'] !== '' ? h($group['date']) : '' ?></td></tr>
  <?php foreach ($group['entries'] as $e): ?>
    <tr>
      <td class="subject"><a href="?r=<?= h($repoName) ?>&a=commit&h=<?= h($e['hash']) ?>"><?= h($e['subject']) ?></a></td>
      <td class="desc"><?= h($e['author']) ?></td>
      <td><a class="pill" href="?r=<?= h($repoName) ?>&a=commit&h=<?= h($e['hash']) ?>"><?= h($e['short']) ?></a></td>
    </tr>
  <?php endforeach; ?>
<?php endforeach; ?>
</table>
</div>

<?php if ($skip > 0 || $hasMore): ?>
<p class="desc">
  <?php if ($skip > 0): ?>
    <a href="?r=<?= h($repoName) ?>&a=log&ref=<?= h($ref) ?>&skip=<?= max(0, $skip - LOG_COUNT) ?>">← newer</a>
  <?php endif; ?>
  <?php if ($hasMore): ?>
    <a href="?r=<?= h($repoName) ?>&a=log&ref=<?= h($ref) ?>&skip=<?= $skip + LOG_COUNT ?>">older →</a>
  <?php endif; ?>
</p>
<?php endif; ?>
