Martin
c40d44e4c9
Add redirect tracking and analysis features
Database Schema:
- Added redirect_url VARCHAR(2048) to pages table
- Added redirect_count INT DEFAULT 0 to pages table
- Added index on redirect_count for faster queries
Configuration:
- Created Config class with typed constants (PHP 8.3+)
- MAX_REDIRECT_THRESHOLD = 3 (configurable warning threshold)
- MAX_CRAWL_DEPTH = 50
- CONCURRENCY = 10
Backend Changes:
- Crawler now tracks redirects using Guzzle's redirect tracking
- Extracts redirect history from response headers
- Records redirect count and final destination URL
- Guzzle configured with max 10 redirects and tracking enabled
API Endpoint:
- New endpoint: /api.php?action=redirects
- Analyzes redirect types (permanent 301/308 vs temporary 302/303/307)
- Identifies excessive redirects (> threshold)
- Returns statistics and detailed redirect information
Frontend Changes:
- Added "Redirects" tab with:
* Statistics overview (Total, Permanent, Temporary, Excessive)
* Detailed table showing all redirects
* Visual warnings for excessive redirects (yellow background)
* Color-coded redirect counts (red when > threshold)
* Status code badges (green for permanent, blue for temporary)
All quality checks pass:
- PHPStan Level 8: 0 errors
- PHPCS PSR-12: 0 errors
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>