Every time a document / file is accessed or even an attempted access the system records this. All changes to documents are recorded with a new revision identification of version, who carried out the change and when.
The latest version is always available, with previous versions being archived either immediately or against a predetermined time date.
No versions of document are lost, they remain in the system in a holding position or in the archive.