preventing title from starting at the end of page

I’m writing a book and I noticed that after compiling I get a title as the last line of the page and then the text on the next page. I don’t want for my title to always start on new pages but I also don’t want it to start on the very last line.
Can I do something about this?
Ideally: “if lines-until-end-of-page < 4 => title on new page”

Any help with this situation?