Last year I took over as the developer of a PHP/MySQL web application with around 350 PHP files and 50 SQL tables. The original author had no prior programming experience. Despite this, the database organisation fairly well normalised, but basically every decision taken after that was sub-optimal. Dates stored as "DD/MM/YY" strings, for example (parts of the app are heavily time-dependant), and an RPC-based API where all input was unsanitised and database changes (CRUD) were allowed via GET calls, accessed via <a> links! I am amazed a robot hasn't indexed all the delete*.php?id= pages :)
After nine months of code clean-up, adding new features, repairing old ones, SQL optimisation, database sanitisation, URL re-writing, and migrating the API to REST (still not complete), the code is now in a position where I would be proud to let others see it.
I intend this answer as a sort of case-study summary. Basically 1 developer, 350 PHP files, 50 tables, took 9 months. Hope that can help you, or any who follow, in gauging how long such a project may take.