The OPAC logout appears to always take you back to opac-main. To test 1) Perform a search 2) Go to the details of a search results 3) Logout 4) Note, you are no longer on the defail page for the record you had searched for.
Tbh it feels right to me that a logout 'resets' for the next user. I think usually you'd only log out when you intend to leave. For the patron account pages, we'd also need to redirect to the login page probably.
I think there's a number of instances where we should be returned to the page that initiated a login/logout. Although Katrin makes a good point too.
I think one of the problems with the current logout is actually that it leaves you on a page that performs a logout if you visit it. If you bookmark that page or refer back to it in some way, you'll be doing a logout every time you visit it. We should probably be redirecting to a URL after logout that would not perform a logout.
I think that Bug 34164 illustrates how "/cgi-bin/koha/opac-main.pl?logout.x=1" can be a problem. I wonder if there's anything that relies on ""/cgi-bin/koha/opac-main.pl?logout.x=1" currently though...