[?] Restrict the figure in the frame of DiscretePlot?

Consider the following code:

DiscretePlot[PrimePi[k], {k, 1, 50}, PlotRange -> {1, 10}, 
         Frame -> True, Joined -> True]

Untitled-1.bmp (83.5 KB)

I met this kind of problem in my research. Above is just an simple example.
How can I restrict the plotrange into the frame not having something out side on the tick label?
Thanks!

Add

PlotRangeClipping -> True

Regards

Thank you!