Protect your database queries from SQL injection.
Recent revisions are kept. Restoring one creates a new revision.