I've recently noticed that our mdl_log file contains dates all the way into the year 2018! After investigating this for hours, I've discovered that this is caused when a course is restored WITH the activity log and the course start date is rolled forward. If the new start date is 173 days later that it was in the course being restored, then all of the dates in the logs are updated to be 173 days later -- even if that date hasn't yet occurred. The log file now contains double the records and the new ones are completely false, but will still affect the statistics when they are reported.
I realize that it is a user error to restore course logs when restoring it to create a copy for the future. However, I don't understand why the roll would even touch those records. Logs are sacred. You'd think there would be some way to ensure there are no future dates in a log file!
The other problem is that when a course is deleted, so are the log records! This is terrible when you're running statistics! I just don't understand why these records are being manipulated this way. Am I looking at the wrong table? Is there another one that I should be looking at?
I feel like I must be missing something important.
We are using Moodle 2.2.5.