How can hardcoded URLs in templates impact the security of a PHP website?

Hardcoded URLs in templates can impact the security of a PHP website by making it vulnerable to URL manipulation attacks, such as phishing or redirection to malicious sites. To address this issue, it is recommended to use PHP functions like `$_SERVER['HTTP_HOST']` or `$_SERVER['REQUEST_URI']` to dynamically generate URLs in templates, rather than hardcoding them.

<a href="<?php echo 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>">Link</a>