How can I ensure a personal trainer is focused on me for the longterm?

Ask and set goals. The best way to ensure this is to be open and selective upfront with the trainer and let them know that you are focused on a long term relationship. Ask to sit down with the trainer to set long term goals for your fitness, diet, weight, and psychology. Look them in the eye and ask if they will be with you long term. People don't like to break the trust of clients and doing this upfront will help.