<html>
    <head>
        <meta name="robots" content="noindex,nofollow">
        <style type="text/css">
            html, body {
                background-color: white;
            }
            td {
                border: 1px solid #ccc;
                border-collapse: collapse;
                padding: 5px;
            }
            table {
                border-collapse: collapse;
                border: 0px;
            }
            a {
                text-decoration: none;
            }
            a:hover {
                text-decoration: underline;
            }
        </style>
    </head>
    <body>

        <h1>A fatal error occurred</h1>

        <div style="width: 640px">

        {% if not isAnonymousUser %}
            <p>
                The following error just broke Piwik{% if showVersion %} (v{{ piwikVersion }}){%  endif %}:
                <pre>{{ lastError.message }}</pre>
                in
                <pre>{{ lastError.file }} line {{ lastError.line }}</pre>
            </p>

            <hr>
            <h3>Troubleshooting</h3>

            Follow these steps to solve the issue or report it to the team:
            <ul>
                <li>
                    If you have just updated Piwik to the latest version, please try to restart your web server.
                    This will clear the PHP opcache which may solve the problem.
                </li>
                <li>
                    If this is the first time you see this error, please try refresh the page.
                </li>
                <li>
                    <strong>If this error continues to happen</strong>, we appreciate if you send the
                    <a href="mailto:hello@piwik.org?subject={{ 'Fatal error in Piwik ' ~ piwikVersion|e('url') }}&body={{ lastError.message|e('url') }}%20in%20{{ lastError.file|e('url') }}%20{{ lastError.line|e('url') }}%20using%20PHP%20{{ constant('PHP_VERSION') }}">error report</a>
                    to the Piwik team.
                </li>
            </ul>
            <hr/>

        {% endif %}

        {% if isSuperUser %}

            <h3>Further troubleshooting</h3>
            <p>
                If this error continues to happen, you may be able to fix this issue by disabling one or more of
                the Third-Party plugins. You can enable them again in the
                <a rel="noreferrer" target="_blank" href="index.php?module=CorePluginsAdmin&action=plugins">Plugins</a>
                or <a target="_blank" href="index.php?module=CorePluginsAdmin&action=themes">Themes</a> page under
                settings at any time.

                {% if pluginCausesIssue %}
                    Based on the error message, the issue is probably caused by the plugin <strong>{{ pluginCausesIssue }}</strong>.
                {% endif %}
            </p>
            <table>
                {% for pluginName, plugin in plugins if plugin.uninstallable and plugin.activated %}
                    <tr {% if loop.index is divisibleby(2) %}style="background-color: #eeeeee"{% endif %}>
                        <td style="min-width:200px;">
                            {{ pluginName }}
                        </td>
                        <td>
                            <a href="index.php?module=CorePluginsAdmin&action=deactivate&pluginName={{ pluginName }}&nonce={{ deactivateNonce }}"
                               target="_blank">deactivate</a>
                        </td>
                    </tr>
                {% endfor %}
            </table>

            {% set uninstalledPluginsFound = false %}
            {% for pluginName, plugin in plugins if plugin.uninstallable and not plugin.activated %}
                {% set uninstalledPluginsFound = true %}
            {% endfor %}

            {% if uninstalledPluginsFound %}

                <p>
                    If this error still occurs after disabling all plugins, you might want to consider uninstalling some
                    plugins. Keep in mind: The plugin will be completely removed from your platform.
                </p>

                <table>
                    {% for pluginName, plugin in plugins if plugin.uninstallable and not plugin.activated %}
                        <tr {% if loop.index is divisibleby(2) %}style="background-color: #eeeeee"{% endif %}>
                            <td style="min-width:200px;">
                                {{ pluginName }}
                            </td>
                            <td>
                                <a href="index.php?module=CorePluginsAdmin&action=uninstall&pluginName={{ pluginName }}&nonce={{ uninstallNonce }}"
                                   target="_blank" onclick="return confirm('{{ 'CorePluginsAdmin_UninstallConfirm'|translate(pluginName)|e('js') }}')">uninstall</a>
                            </td>
                        </tr>
                    {% endfor %}
                </table>
            {% endif %}

        {% elseif isAnonymousUser %}

            <p>Please contact the system administrator, or login to Piwik to learn more.</p>

        {% else %}
            <p>
                If this error continues to happen you may want to send an
                <a href="mailto:{{ emailSuperUser }}?subject={{ 'Fatal error in Piwik ' ~ piwikVersion|e('url') }}&body={{ lastError.message|e('url') }}%20in%20{{ lastError.file|e('url') }}%20{{ lastError.line|e('url') }}%20using%20PHP%20{{ constant('PHP_VERSION') }}">error report</a>
                to your system administrator.
            </p>
        {% endif %}

        </div>

    </body>
</html>