<table class="data-table">
    <thead>
        <tr>
            <th>Datei</th>
            <th>Groesse (Quelle)</th>
            <th>Groesse (Ziel)</th>
            <th>Dauer</th>
            <th>FPS</th>
            <th>Speed</th>
            <th>Status</th>
        </tr>
    </thead>
    <tbody>
        {% for entry in entries %}
        <tr>
            <td title="{{ entry.source_path }}">{{ entry.source_filename }}</td>
            <td>{{ "%.1f"|format(entry.source_size_bytes / 1048576) }} MiB</td>
            <td>{{ "%.1f"|format((entry.target_size_bytes or 0) / 1048576) }} MiB</td>
            <td>{{ "%.0f"|format(entry.duration_sec or 0) }}s</td>
            <td>{{ "%.1f"|format(entry.avg_fps or 0) }}</td>
            <td>{{ "%.2f"|format(entry.avg_speed or 0) }}x</td>
            <td>
                {% if entry.status == 2 %}
                <span class="status-badge ok">OK</span>
                {% elif entry.status == 3 %}
                <span class="status-badge error">Fehler</span>
                {% elif entry.status == 4 %}
                <span class="status-badge warn">Abgebrochen</span>
                {% else %}
                <span class="status-badge">{{ entry.status }}</span>
                {% endif %}
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>

{% if entries | length >= 25 %}
<div class="pagination">
    <button hx-get="/htmx/stats?page={{ page + 1 }}"
            hx-target="#stats-table"
            hx-swap="innerHTML"
            class="btn-secondary">
        Weitere laden...
    </button>
</div>
{% endif %}
