*8996* Porting stats fixes

To make that perfect, you should just go:
foreach (array_keys($sortedBaseUrls) as $workingBaseUrl) {

No need for the unused  $baseUrlLength var