Two posts are loaded instead of one?

The core of the problem is that you set cookies when the content is being accessed, not when it is read. Browsers can try to prefetch content, and your description sound like the browser is prefecthing the “next” link found in the header.

From experience, you should avoid setting cookies on the server and prefer setting them on client side (add to the html a small JS that will set the cookie) or even better if possible, use local storage instead.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)