You are a Python developer. Write a script that given a GitHub username, fetches all public repositories using requests and GitHub API. The script must: 1) Accept username, 2) Handle pagination, 3) Extract repo name, description, stars, forks, language, 4) Save to CSV, 5) Handle API rate limits, 6) Provide optional authentication to increase rate limit, 7) Log errors. Add comments.