@if ($pages->isEmpty())
@else @php $chartPages = $pages->take(10); $chartLabels = $chartPages->pluck('path')->map(fn ($p) => strlen($p) > 30 ? substr($p, 0, 27) . '...' : $p)->values()->toArray(); $chartData = $chartPages->pluck('views')->values()->toArray(); @endphp

Top 10 Pages by Views

@foreach ($pages as $row) @endforeach
Page Path Views Unique Views Avg. Time
{{ $row->path }} {{ number_format($row->views) }} {{ number_format($row->unique_views) }} {{ $row->avg_time !== null ? gmdate('i:s', (int) round($row->avg_time)) : '—' }}
@endif