$name, 'size_bytes' => filesize($path), 'last_modified' => date('c', filemtime($path)), 'age_days' => round((time() - filemtime($path)) / 86400), ]; } } // Enrich with category + suggestion $categorize = function($name) { $n = strtolower($name); if (strpos($n, 'ethica') !== false) return ['marketing', 'Add link in WTP Marketing & Email module']; if (strpos($n, 'wevia') !== false) return ['ai', 'Add link in WTP Intelligence IA module']; if (strpos($n, 'wevads') !== false) return ['marketing', 'Add link in WTP Marketing & Email module']; if (strpos($n, 'sap') !== false || strpos($n, 'vistex') !== false) return ['erp', 'Add link in WTP ERP Integrations module']; if (strpos($n, 'huawei') !== false || strpos($n, 'cloud') !== false) return ['cloud', 'Add link in WTP Operations & Infra module']; if (strpos($n, 'agent') !== false) return ['ai', 'Add link in WTP Intelligence IA / RH & Talent']; if (strpos($n, 'test') !== false || strpos($n, 'demo') !== false) return ['dev', 'Archive to /tests/ or /demos/ folder']; if (strpos($n, 'admin') !== false || strpos($n, 'dashboard') !== false) return ['operations', 'Add to WTP Operations & Infra']; if (strpos($n, 'security') !== false || strpos($n, 'gdpr') !== false) return ['security', 'Add to WTP Security & Compliance']; if (strpos($n, 'consent') !== false || strpos($n, 'privacy') !== false) return ['legal', 'Link from footer legal/privacy']; if (strpos($n, 'ia') !== false || strpos($n, '-ai') !== false) return ['ai', 'Add link in WTP Intelligence IA']; if (strpos($n, 'landing') !== false || strpos($n, 'nearshore') !== false) return ['marketing-landing', 'Verify SEO referenced, else add to sitemap']; return ['other', 'Manual review - may be archived']; }; foreach ($orphans as &$o) { list($cat, $sug) = $categorize($o['file']); $o['category'] = $cat; $o['wire_suggestion'] = $sug; } // Count by category $by_cat = []; foreach ($orphans as $o) { $by_cat[$o['category']] = ($by_cat[$o['category']] ?? 0) + 1; } arsort($by_cat); $data = [ 'total_html_pages' => count($all_html), 'referenced' => count($referenced), 'orphans_count' => count($orphans), 'orphans' => $orphans, 'by_category' => $by_cat, 'scan_anchors' => $anchor_files, ]; } $data['v'] = 'V96.19-pages-orphans-opus'; $data['ts'] = date('c'); $data['note'] = 'Scan files in /var/www/html/*.html not referenced from index/WTP. Wire suggestions provided per file.'; echo json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);