Call Route from other Route

I have a question based on the routing with slim.

I have to routes.

Route 1:

Route 2:

When a user want to get stats, a login is need first. But i don’t want to implement the login twice.
So my idea is, if a user called the /stats route, the /login route is called internal first.

But how can i redirect from /stats to /login?

Or should i implement the logic in a seperate method and call this method in /login and in /stats?

This would typically be handled is through an authentication/authorization middleware. When a user attempts to go to /stats, the middleware gets called. If the user has logged in they will be sent along to /stats. However if the user is not logged in, the middleware will redirect the user to the /login page.