Prevent invalid activation page failure
In your config, you can set activateAccountFailurePath to something like:

'activationAccountFailurePath' =&gt; 'members/failed?access=1'

In your template, you can check for the URL parameter 'access' and 404 if it is not set.

Template:

{% if craft.request.getParam('access') != '1' %}
   {% exit 404 %}
{% endif %}

{# rest of your template if parameter is available #}


Of course, someone could still access the page if they had the full URL with the parameter, but it should help limit access.