I would not get a CPU more expensive than the 8400. The 1050ti is a budget GPU and the 8400 is a midrange CPU. So it is not a bad pairing. Typically, GPUs show their age long before a CPU, so getting the 8400 now will give your a really nice foundation for you platform for the next several years.
Not sure when you are looking to buy, but AMDs new Ryzen CPUs will be released in April and they may challenge the 8400.