Legal Foundations for the Safe Use of AI: GDPR, Copyright Law, and the EU AI Act